<template>
  <div class="tableGreenBox">
    <el-table class="tableGreen" :data="farmStockList" style="width: 100%">
      <el-table-column label="农资名称" header-align="center" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.name }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column label="登记证号" width="180">
        <template slot-scope="scope">
          <span>{{ scope.row.date }}</span>
        </template>
      </el-table-column> -->
      <!-- <el-table-column label="类别" header-align="center" align="center" width="100">
        <template slot-scope="scope">
          <span>{{ scope.row.typeFormat }}</span>
        </template>
      </el-table-column> -->
      <el-table-column label="生产厂家" header-align="center" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.manufacturer }}</span>
        </template>
      </el-table-column>
      <el-table-column label="规格（公斤/袋）" header-align="center" align="center" width="160">
        <template slot-scope="scope">
          <span>{{ scope.row.specifications }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column label="库存（公斤）" header-align="center" align="center" width="160">
        <template slot-scope="scope">
          <span>{{ scope.row.remainingQuantity }}</span>
        </template>
      </el-table-column> -->
      <el-table-column label="操作" header-align="center" align="center" width="100">
        <template slot-scope="scope">
          <el-button size="mini" class="greenColorBtn" @click="handleChoose(scope.row)"
            >选择</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <div class="pagination mt20">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :current-page.sync="currentPage"
        :page-size="dialogParams.pageSize"
        layout="prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  name: 'SevencolorUserFarmStockDialog',
  props: {
    farmStockList: {
      type: Array
    },
    getAgriculturalDict: {
      type: Function
    },
    total: {
      type: Number
    }
  },

  data () {
    return {
      dialogVisible: true,
      dialogParams: {
        current: 1,
        pageSize: 8
      },
      currentPage: 1
      // total: null
    }
  },
  computed: {
  },
  mounted () {},

  methods: {
    handleChoose (data) {
      // console.log(data)
      this.$emit('farmsStockData', data)
    },
    handleCurrentChange (val) {
      this.dialogParams.current = val
      this.getAgriculturalDict(this.dialogParams)
      // console.log(val)
      // this.$emit('dialogParams', val)
      // console.log(this.params)
    }
  }
}
</script>
<style lang="scss" scoped>
// .dialog {

// }
.pagination {
  text-align: right;
}
</style>
